home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
doors_2
/
useron33.zip
/
DOIT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-11-02
|
3KB
|
121 lines
{-----------------------------------------------------------------------------|
DoIt 1.1
Gerhard Hoogterp (2:283/1.2 27:4331/106 HOOGTERPG@HENUT5.BITNET)
04 Nov 1991
Dumped in the Public domain, do with it whatever you like. Note however
that the usage of this unit is completely on your own risk!
Oh, don't make the DoString longer than 70 characters. UserOn.Exe will chop
them off....
1.1:
Added the DoPath. under RA 1.10 UserOn will use the Semafore directory.
Since this path is only known in the Config.Ra, I can't find it in this
little demo unit. Default, the DoPath is the same as the system path.
The directory the RA environment variable points to. Put the Semafore Path
inside this variable when you want to use it under RA 1.10.
|-----------------------------------------------------------------------------}
Unit DoIt;
Interface
Uses Dos;
Type DoString = String[70];
Var DoPath : PathStr;
{------------------------------------------------------------------------|
Fill DoingWhat with the string you want to appear in the UserOn door
|------------------------------------------------------------------------}
Const DoingWhat : DoString = 'Working with a LiveSystems door.';
DefaultStr: DoString = 'In a door/external utility';
{------------------------------------------------------------------------|
GrabInfo Lookes for the USERDOES.<NodeNr> file and returns it's
contents when found. If not found the default string is returned.
|------------------------------------------------------------------------}
Function GrabInfo(LineNr : Byte):DoString;
{------------------------------------------------------------------------|
SetDoingInfo writes a file USERDOES.<NodeNr> with the DoingWhat string
|------------------------------------------------------------------------}
Procedure SetDoingInfo(LineNr : Byte);
{------------------------------------------------------------------------|
ClearDoingInfo erases the USERDOES.<NodeNr>
|------------------------------------------------------------------------}
Procedure ClearDoingInfo(LineNr : Byte);
Implementation
Type Str2 = String[2];
Function S(Number : Byte;Size:Byte):Str2;
Var HStr : Str2;
Begin
Str(Number:Size,HStr);
S:=HStr;
End;
Procedure CompletePath(Var Path : String);
Begin
Path:=FExpand(Path);
If (Path[Length(Path)]<>'\') And
(Path[Length(Path)]<>':')
Then Path:=Path+'\';
End;
Function GrabInfo(LineNr : Byte):DoString;
Var DoIt : Text;
Line : DoString;
Begin
FileMode:=64; { ReadOnly/ShareDenyNone }
Assign(DoIt,DoPath+'UserDoes.'+S(LineNr,0));
Reset(DoIt);
If IoResult<>0
Then Begin
GrabInfo:=DefaultStr;
Exit;
End;
ReadLn(DoIt,Line);
Close(DoIt);
If Length(Line)>70
Then Line[0]:=#70;
GrabInfo:=Line;
End;
Procedure SetDoingInfo(LineNr : Byte);
Var DoIt : Text;
Begin
FileMode:=49; { WriteOnly/ShareDenyRead }
Assign(DoIt,DoPath+'UserDoes.'+S(LineNr,0));
Rewrite(DoIt);
WriteLn(DoIt,DoingWhat);
Close(DoIt);
End;
Procedure ClearDoingInfo(LineNr : Byte);
Var DoIt : File;
Begin
FileMode:=17; { WriteOnly/ShareDenyAll }
Assign(DoIt,DoPath+'UserDoes.'+S(LineNr,0));
Erase(DoIt);
End;
Begin
DoPath:=GetEnv('RA');
CompletePath(RAPath);
End.